#ifndef _UTILS_H_
#define _UTILS_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>

#define MAX(a,b) ( ((a)>(b)) ? (a):(b) )
#define MIN(a,b) ( ((a)>(b)) ? (b):(a) )

#define DEF_CMD(MODULE,CMD) {#CMD, MODULE##_parse_##CMD, MODULE##_exec_##CMD}

#define PARSE_FUN(MODULE,CMD) MODULE##_parse_##CMD

#define EXEC_FUN(MODULE,CMD) MODULE##_exec_##CMD

char *trimstr(char *string);
char *trimleftblank(char *string);
void trimrightblank(char *string);
char *get_delimited_string(char *string, char delim, char *ret_segment);

#ifdef __cplusplus
}
#endif

#endif